﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PriceLibrary.PriceService;

namespace VDataAdapter.PriceServerAdapter
{
    /// <summary>
    /// This is basically the same with IPriceServiceEventHandler
    /// However all input data is in the correct type in the first place
    /// </summary>
    public interface IPriceServiceHandler
    {/// <summary>
        /// Handle GetFirstTime callback event from PriceServer
        /// This event will happen once at the begining when connect to PriceServer
        /// And send all data from begining of day up until to the time of connection
        /// </summary>
        /// <param name="baseprices"></param>
        /// <param name="top3Prices"></param>
        void GetFirstTime(IDictionary<string, StockBase> basePrices, IDictionary<string, StockInfoDyns> top3Prices);

        /// <summary>
        /// Handle update top3Prices callback event from PriceServer
        /// This event will happen everytime there is a changed in StockBase: can be:
        /// - Change in Top3Price
        /// - Change in Stock Transaction (a.k.a 1 update o Khoi luong khop, gia khop)
        /// </summary>
        /// <param name="top3Prices"></param>
        void Top3PricesStock_Changed(IDictionary<string, StockInfoDyns> top3Prices);

        /// <summary>
        /// Handle update MarketInfo callback event from PriceServer
        /// This event will happen if there is an update in the Market Chart (đồ thị chỉ số)
        /// When connect the first time, there will be no data from the begining of day up until 
        /// the time of connection, since transaction data of marketInfo is sent inside Transactions event
        /// and each Market Index is treated as a normal symbol (i.e. HOSE, HNX along with VND, SSI etc)
        /// - 
        /// chỉ bao gồm thông tin khớp lệnh của các chỉ số trong ngày (dùng để update chart)
        /// không bao gồm thông tin từ đầu ngày.
        /// 
        /// Các thông tin từ đầu ngày được gửi thông qua sự kiện (event) Transactions_Changed
        /// </summary>
        /// <param name="maketinfos"></param>
        void MarketInfo_Changed(IDictionary<int, MarketInfo> maketinfos);

        /// <summary>
        /// Handle PutThrough TopPrices callback event from PriceServer
        /// 
        /// </summary>
        /// <param name="newstockbase"></param>
        void PutThroughTopPrices_Changed(IList<StockInfoDyns> newstockbase);

        /// <summary>
        /// Handle PutThroughTransactions event callback from PriceServer
        /// </summary>
        /// <param name="newstockbase"></param>
        void PutThroughTransactions_Changed(IList<Transaction> newstockbase);

        /// <summary>
        /// Handle PutThroughTransactions event callback from PriceServer
        /// </summary>
        /// <param name="newstockbase"></param>
        void Transactions_Changed(IList<PriceLibrary.ChartService.Transaction> transactions, int countNumber, int totalCountNumber);
   
    }
}
